java
html
php
css
c
mysql
database
linux
android
ruby-on-rails
regex
objective-c
visual-studio
perl
tsql
php5
asp
api
jsp
dom
Comment the header('Content-type: image/png'); and call the script from browser. Check for messages that might appear before the garbage related to the image itself.
header('Content-type: image/png');
You may need to add error_reporting(E_ALL); ini_set('display_errors', 1); at the top of the script in case error reporting/display is turned off as well.
error_reporting(E_ALL); ini_set('display_errors', 1);